const domainName = getApp().globalData.domainName
const parameter = getApp().globalData.parameter
const jg_stu_id = wx.getStorageSync('jg_stu_id')

// pages/gs/book_library/book_library.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    loading:true,
    windowWidth:wx.getSystemInfoSync().windowWidth,
    lis:[]
  },

  tap_item(e){
    getApp().get_vibration()
    let index = e.currentTarget.id
    wx.navigateTo({
      url: '/pages/book/book_show/book_show?url=' + this.data.lis[index].url,
    })
  },

  page_init(jg_stu_id){
    wx.request({
      url: domainName + '/book_library_init',
      data: {jg_stu_id},...parameter,
      success: res => {
        this.setData({
          lis:res.data.lis,
          loading:false
        })
      },
    })
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {
    this.page_init(jg_stu_id)
  },

})